function [nu_ml_tilda,K_ml]=Gen_DD_channel_kml(N,M,L_set,gs)
l_max=max(L_set);
nu_ml_tilda=zeros(N,M,l_max+1);

K_ml=zeros(N,N,M,l_max+1);
Fn=dftmtx(N);
Fn=Fn./norm(Fn);
for m=1:M
    for l=(L_set+1)
        for n=1:N
            nu_ml_tilda(n,m,l)=gs(l,m+(n-1)*M);         %equation(42) in [R1]
        end
        K_ml(:,:,m,l)=Fn*diag(nu_ml_tilda(:,m,l))*Fn';  %Section III-A in [R1]      
    end
end
end